package com.linqi.freebie

import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState
import com.linqi.freebie.http.DoHttp
import io.github.aakira.napier.DebugAntilog
import io.github.aakira.napier.Napier
import java.awt.Dimension

fun main() {

    AppInitializer.init()//初始化

    application {
        val state = rememberWindowState(
            width = 800.dp,
            height = 600.dp,
            // placement = WindowPlacement.Maximized
        )

        Window(
            onCloseRequest = {
                // 先做你想做的事情
                DoHttp.getInstance().close()
                // 退出程序
                exitApplication()
            },
            title = "FreebieStƎam",
            state = state,
            undecorated = false//是否隐藏窗口的默认装饰（标题栏、边框、关闭按钮等）
        ) {
            // 设置最小窗口大小 (通过 AWT)
            LaunchedEffect(Unit) {
                window.minimumSize = Dimension(800, 600) // 像素单位
            }
            App()
        }
    }

}

